import 'package:flutter/material.dart';

import 'package:v10/ba_air.dart';
import 'package:v10/ba_email.dart';
import 'package:v10/bs_home.dart';
import 'package:v10/bs_page.dart';

class BtAppMain extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new BtApp();
  }
}

class BtApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return BtAppState();
  }
}

class BtAppState extends State<BtApp> {
  int _currentIndex = 0;
  List<Widget> pages = List<Widget>();

  @override
  void initState() {
    super.initState();
    pages..add(new Home())..add(new Email())..add(new Page())..add(new Air());
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: pages[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        items: [
          BottomNavigationBarItem(
              icon: Icon(Icons.home, color: Colors.redAccent),
              title: Text(
                'HOME',
                style: TextStyle(color: Colors.redAccent),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.email,
                color: Colors.redAccent,
              ),
              title: Text(
                'Email',
                style: TextStyle(color: Colors.redAccent),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.pages,
                color: Colors.redAccent,
              ),
              title: Text(
                'PAGES',
                style: TextStyle(color: Colors.redAccent),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.airplay,
                color: Colors.redAccent,
              ),
              title: Text(
                'AIRPLAY',
                style: TextStyle(color: Colors.redAccent),
              )),
        ],
        currentIndex: _currentIndex,
        onTap: (int index) {
          setState(() {
            _currentIndex = index;
          });
        },
      ),
    );
  }
}
